Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Collections.​ObjectModel.​ReadOnlyCollection<​T>

Assembly: System.Runtime

Inheritance: object → ReadOnlyCollection

Implemented Interfaces

Provides the base class for a generic read-only collection.

Properties

public int
Count
Gets the number of elements contained in the <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> instance.
public static ReadOnlyCollection<​T>
Empty
Gets an empty <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> .
public T
Item
protected Generic.​IList<​T>
Items
Returns the <see cref="T:System.Collections.Generic.IList`1" /> that the <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> wraps.

Methods

public bool
Contains​(T value)
Determines whether an element is in the <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> .
Returns <see langword="true" /> if <paramref name="value" /> is found in the <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> ; otherwise, <see langword="false" /> .
value The object to locate in the <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> . The value can be <see langword="null" /> for reference types.
public void
CopyTo​(T[] array, int index)
Copies the entire <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> to a compatible one-dimensional <see cref="T:System.Array" /> , starting at the specified index of the target array.
array The one-dimensional <see cref="T:System.Array" /> that is the destination of the elements copied from <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> . The <see cref="T:System.Array" /> must have zero-based indexing.
index The zero-based index in <paramref name="array" /> at which copying begins.
public Generic.​IEnumerator<​T>
GetEnumerator​()
Returns an enumerator that iterates through the <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> .
Returns An <see cref="T:System.Collections.Generic.IEnumerator`1" /> for the <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> .
public int
IndexOf​(T value)
Searches for the specified object and returns the zero-based index of the first occurrence within the entire <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> .
Returns The zero-based index of the first occurrence of <paramref name="value" /> within the entire <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> , if found; otherwise, -1.
value The object to locate in the <see cref="T:System.Collections.Generic.List`1" /> . The value can be <see langword="null" /> for reference types.
public bool
Equals​(object obj)
Inherited from object
Determines whether the specified object is equal to the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
obj The object to compare with the current object.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public int
GetHashCode​()
Inherited from object
Serves as the default hash function.
Returns A hash code for the current object.
public Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .
public string
ToString​()
Inherited from object
Returns a string that represents the current object.
Returns A string that represents the current object.